package com.dagger.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.dagger.common.RestResult;

import lombok.extern.slf4j.Slf4j;

/**
 * 样例接口
 * 
 * @author dagger
 *
 */
@Slf4j
@RestController
@RequestMapping("demo")
public class DemoController {

	@GetMapping("apiGet")
	public RestResult<String> apiGet(@RequestParam(value = "p1", required = false) String p1) {
//    	try {
//			Thread.sleep(800);
//		} catch (InterruptedException e) {
//			log.error(e.getLocalizedMessage(), e);
//		}
		return RestResult.MsgResult(RestResult.MSG_OPERATE_SUCCESS);
//    	throw new RuntimeException("test");
	}

	@PostMapping("apiPost")
	public RestResult<String> apiPost() {

		return RestResult.MsgResult(RestResult.MSG_OPERATE_SUCCESS);
	}
}
